package com.xiaobao.coalproperty.other.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class FormatUtils {

    private SimpleDateFormat dateFormat;

    private static volatile FormatUtils mFormatUtils = null;

    private FormatUtils() {
        dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    }

    public synchronized static FormatUtils getInstance() {
        if (mFormatUtils == null) {
            mFormatUtils = new FormatUtils();
        }
        return mFormatUtils;
    }

    public String formatDate(Date date) {
        return dateFormat.format(date);
    }

    public Date formatDate(String date) throws Exception {
        return dateFormat.parse(date);
    }
}
